#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cstring>
#include <cassert>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <unistd.h>

#define N 	401
#define INF 0x70000000
using namespace std; 

struct pnt_t {
	int x, y, d; 
	pnt_t(int i, int j, int di) {
		x = i; 
		y = j; 
		d = di; 
	}
	bool operator<(const pnt_t &a) const {
		return a.x < x; 
	}
}; 

int n, m, sx, sy; 
int a[N][N]; 

int main()
{
	int i, j; 
	priority_queue<pnt_t> q; 
	int dir[8][2] = {
		{-2,  1}, 
		{-2, -1}, 
		{ 2,  1}, 
		{ 2, -1}, 
		{ 1, -2}, 
		{-1, -2}, 
		{ 1,  2}, 
		{-1,  2}, 
	}; 
	
	//freopen("p1143_2.in", "r", stdin); 
	cin>>n>>m>>sx>>sy; 
	for (i=1; i<=n; i++) {
		for (j=1; j<=m; j++) {
			a[i][j] = INF; 
		}
	}
	a[sx][sy] = 0; 
	q.push(pnt_t(sx, sy, 0)); 
	while(!q.empty()) {
		int d, x, y; 
		pnt_t p = q.top(); 
		q.pop(); 
		for (d=0; d<8; d++) {
			x = p.x + dir[d][0]; 
			y = p.y + dir[d][1]; 
			if (x<1 || x>n || y<1 || y>m)
				continue;
			if (p.d + 1 < a[x][y]) {
				a[x][y] = p.d + 1; 
				q.push(pnt_t(x, y, p.d + 1)); 
			}
		}
	}

    for (int i=1;i<=n;i++){
        for (int j=1;j<=m;j++)
            printf("%-5d", (a[i][j]==INF?-1:a[i][j]));  
        printf("\n");
    }
	
/*	
	for (i=1; i<=n; i++) {
		for (j=1; j<=m; j++) {
			cout<<(a[i][j]==INF?-1:a[i][j])<<" "; 
		}
		cout<<endl; 
	} */
	return 0; 
}



